<?php
    session_start();
    include '../Sql/DBSeguridadDAO.php';
    include '../Sql/Conexion.php';
    include '../Sql/ClaseDB.php';
    include '../Php/Panel.php';
    include '../Exception/CustomException.php';
    include '../Exception/ExceptionHandler.php';

    $dbSeguridadDAO = new DBSeguridadDAO();
    extract( $_POST );
    $plantillaP = new Panel( "../View/Plantilla.html" );
    $plantillaEC = new Panel( "../View/Encabezado.html" );
    $plantillaEC->add( "TITULO" , "Principal" );

    if(!$dbSeguridadDAO->login( $cedula , $clave )){
        header( "location: ../Index.php?error=1" );
    }
    

    $plantillaEC->add( $_SESSION );

    if ( $_SESSION['USR_PRIVILEGIO'] == 'ADMIN' ){
        $plantillaPrivilegio = new Panel( "../View/MenuPrivilegio.html" );
        $plantillaEC->add( "MENU_PRIVILEGIO" , $plantillaPrivilegio );
    }

    $plantillaP->add( "ENCABEZADO" , $plantillaEC );
    $plantillaPIE = new Panel( "../View/Pie.html" );
    $plantillaP->add( "PIE" , $plantillaPIE );
    $plantillaP->show();
    
?>